package com.design.patterns.list.state.eg;

/**
 * 不能抽奖
 *
 * @author Wangzhiwen
 */
public class NoState implements ActivityState {

    private final ActivityContext context;

    public NoState(ActivityContext context) {
        this.context = context;
    }

    @Override
    public void deduct() {
        System.out.println("扣除50积分成功，您可以抽奖了");
        // 流转状态
        context.setState(context.canState);
    }

    @Override
    public boolean lottery() {
        System.out.println("扣除积分后才允许抽奖");
        return false;
    }

    @Override
    public void grant() {
        System.out.println("当前状态不能发放奖品");
    }
}
